home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / Call.au3 < prev    next >
Text File  |  2007-09-08  |  1KB  |  35 lines

  1. ; This calls a function accepting no arguments.
  2. Call("Test1")
  3.  
  4. ; This calls a function accepting one argument and passes it an argument.
  5. Call("Test2", "Message from Call()!")
  6.  
  7. ; This demonstrates how to use the special array argument.
  8. Global $aArgs[4]
  9. $aArgs[0] = "CallArgArray" ; This is required, otherwise, Call() will not recognize the array as containing arguments
  10. $aArgs[1] = "This is a string"    ; Parameter one is a string
  11. $aArgs[2] = 47    ; Parameter two is a number
  12. Global $array[2]
  13. $array[0] = "Array Element 0"
  14. $array[1] = "Array Element 1"
  15. $aArgs[3] = $array    ; Parameter three is an array
  16.  
  17. ; We've built the special array, now call the function
  18. Call("Test3", $aArgs)
  19.  
  20. Func Test1()
  21.     MsgBox(4096, "", "Hello")
  22. EndFunc
  23.  
  24. Func Test2($sMsg)
  25.     MsgBox(4096, "", $sMsg)
  26. EndFunc
  27.  
  28. Func Test3($sString, $nNumber, $aArray)
  29.     MsgBox(4096, "", "The string is: " & @CRLF & $sString)
  30.     MsgBox(4096, "", "The number is: "& @CRLF & $nNumber)
  31.     For $i = 0 To UBound($aArray) - 1
  32.         MsgBox(4096, "", "Array[" & $i & "] contains:" & @CRLF & $aArray[$i])
  33.     Next
  34. EndFunc
  35.